define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'system.version/index',
        add_url: 'system.version/add',
        edit_url: 'system.version/edit',
        delete_url: 'system.version/delete',
        export_url: 'system.version/export',
        modify_url: 'system.version/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                toolbar:['add'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'aid'},
                    {field: 'plat', search: 'select', selectList: ea.getDataBrage('select_list_plat'), title: '更新设备'},
                    {field: 'port', search: 'select', selectList: ea.getDataBrage('select_list_port'), title: '更新端口'},
                    {field: 'url', title: '更新包', templet: ea.table.url},
                    {field: 'size', title: '更新包大小'},
                    {field: 'version_name', title: '版本号'},
                    {field: 'version', title: '标识'},
                    {field: 'type', search: 'select', selectList: ea.getDataBrage('select_list_type'), title: '更新类型'},
                    {field: 'is_force', search: 'select', selectList: ea.getDataBrage('select_list_is_force'), title: '强制更新'},
                    {field: 'is_plan', search: 'select', selectList: ea.getDataBrage('select_list_is_plan'), title: '计划更新'},
                    {field: 'plan_time', title: '计划更新时间'},
                    {field: 'readme', title: '更新说明'},
                    {field: 'status', search: 'select', selectList: ea.getDataBrage('select_list_status'), title: '状态', templet: ea.table.switch},
                    {field: 'create_time', title: '创建时间'},
                    {width: 250, title: '操作', templet: ea.table.tool , fixed:'right',operat: ['delete']},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});